<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" session="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
    <meta name="renderer" content="webkit">
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
    <META HTTP-EQUIV="Expires" CONTENT="0">
    <title>云平台管理</title>

    <link href="${pageContext.request.contextPath}/static/css/common.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/bootstrap-3.3.5/css/bootstrap.min.css"
          rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/font-awesome-4.3.0/css/font-awesome.min.css"
          rel="stylesheet">
    <!-- jqgrid-->
    <link href="${pageContext.request.contextPath}/static/plugins/jqGrid/css/custom.ui.jqgrid.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/layer/skin/layer.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/jqGrid/css/style.css" rel="stylesheet">
	<link href="${pageContext.request.contextPath}/static/plugins/select2-4.0.0/dist/css/select2.min.css"
          rel="stylesheet">
    <script src="${pageContext.request.contextPath}/static/js/jquery-1.11.3.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/jquery.form.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/common.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/bootstrap-3.3.5/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/jqGrid/js/i18n/grid.locale-cn.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/jqGrid/js/minified/jquery.jqGrid.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/layer/layer.js" type="text/javascript"></script>
    <script src="${pageContext.request.contextPath}/static/js/global.js"></script>
	<script src="${pageContext.request.contextPath}/static/plugins/select2-4.0.0/dist/js/select2.min.js"></script>
	<script type="text/javascript"
            src="${pageContext.request.contextPath}/static/plugins/My97DatePicker/WdatePicker.js"></script>

    <style type="text/css">
        .main h5 a {
            position: absolute;
            right: 20px;
            font-size: 14px;
            bottom: 0px;
            display: inline-block;
            padding: 5px;
        }

        .table_list tbody tr {
            height: 35px;
            text-align: center;
        }
       .panel{
			*+margin-left:270px;
			
		}
		.lt{
			float:left;
		}
		.rt{
			float:right;
		}
		.jqGrid_wrapper{
			*+margin-left:270px;
			
		}
		.btn{
			*+width:60px
		}
		.panel-body{
			overflow:hidden;
		}
    </style>
</head>
<body view="menu-item-4142">
<jsp:include page="top.jsp"></jsp:include>
<div class="right">
	<div class="wrapper">
        <div class="panel panel-default">
            <div class="panel-heading">
                <span><strong>查询条件</strong></span>

                <div class="ibox-tools">
                    <a class="collapse-link"> <i class="fa fa-chevron-down"></i></a>
                    <a class="collapse-link  d-n"> <i class="fa fa-chevron-up"></i></a>
                </div>
            </div>
            <div class="panel-body">
                <form class="form-horizontal">
                    <div class="form-group">
	               		<label class="selectlabe1 col-md-1 form-lable lt">公司名称：</label>
	                    <div class="selectdivs col-md-3 lt">
	                        <select name="agtCode" id="agtCode" class="form-control col-md-1"></select>
	                    </div>
	                    
	                    <label class="selectlabe2 col-md-1 form-lable lt" style="width: 90px;">小区名称：</label>
	                    <div class="selectdivs col-md-3 lt" >
	                        <select name="communityId" id="communityId" class="form-control col-md-1"></select>
	                    </div>
	                    <div class="col-md-1 form-action lt">
                            <button class="btn btn-success form-control" style="width: 73px;" id="query">运营数据</button>
                        </div>
                        <div class="col-md-1 form-action lt ">
                            <button class="btn btn-success form-control" id="resetForm">清空</button>
                        </div>
                      </div>
                </form>
            </div>
        </div>
	    
	    <div class="jqGrid_wrapper">
	            
	        <table id="jqGrid"></table>
		</div>
    </div>
</div>
<script>
    $(document).ready(
            function () {
                $.jgrid.defaults.styleUI = "Bootstrap";
                var array=new Array();
                for(var i=1;i<7;i++){
                 array[i] =GetDateStr(-i);
                }
                $("#jqGrid").jqGrid(
                        {
                        	url: "${pageContext.request.contextPath}/admin/tagent_pmsReports.action",
                            mtype: 'POST',
                            datatype: "json",
                            height: 510,
                            autowidth: true,
                            shrinkToFit: true,
                            rowNum: 20,
                            rowList: [10, 20, 30],
                            colNames: ['掌连运营数据', '全部', '今日', array[1], array[2], array[3], array[4],
                                       array[5], array[6], '近30日' ,'本季度'],
                            colModel: [{
                                name: 'CNAME',
                                index: 'CNAME',
                                sortable:false
                            },{
                                name: 'COUNTNUM',
                                index: 'COUNTNUM',
                                sortable:false
                            }, {
                                name: 'A',
                                index: 'A',
                                sortable:false
                            },{
                                name: 'B',
                                index: 'B',
                                sortable:false
                            },{
                                name: 'C',
                                index: 'C',
                                sortable:false
                            }, {
                            	name: 'D',
                                index: 'D',
                                sortable:false
                            }, {
                            	name: 'E',
                                index: 'E',
                                sortable:false
                            }, {
                            	name: 'F',
                                index: 'F',
                                sortable:false
                            }, {
                            	name: 'G',
                                index: 'G',
                                sortable:false
                            }, {
                            	name: 'H',
                                index: 'H',
                                sortable:false
                            }, {
                            	name: 'I',
                                index: 'I',
                                sortable:false
                            }],
                            rownumbers: false,
                            jsonReader: {
                                root: 'rows',
                                page: "page",
                                total: 'total',
                                records: "records",
                                repeatitems: false
                            },
                            pager: "#jqGrid_paper",
                            viewrecords: false,
                            multiselect: false,
                            hidegrid: false
                        });
                $.post("${pageContext.request.contextPath}/admin/tagent_list.action", function (data) {
		            $("#agtCode").empty();
		            $("#agtCode").append("<option value=''>请选择公司</option>");
		            for (var i = 0; i < data.length; i++) {
		                $("#agtCode").append("<option value='" + data[i].agtCode + "'>" + data[i].agtName + "</option>");
		            }
		            $("#agtCode").select2({
		                "placeholder": "请选择公司",
		                "width": "100%"
		            })
		            $("#communityId").select2({
				                "placeholder": "请选择社区",
				                "width": "100%"
				            })
		            $("#agtCode").change(function () {
		            	var data = $(this).val();
		            	$.post("${pageContext.request.contextPath}/admin/tcommunity_list.action", {"agtCode": data},function (data) {
				            $("#communityId").empty();
				            $("#communityId").append("<option value=''>请选择社区</option>");
				            for (var i = 0; i < data.length; i++) {
				                $("#communityId").append("<option value='" + data[i].sid + "'>" + data[i].communityName + "</option>");
				            }
				            $("#communityId").select2({
				                "placeholder": "请选择社区",
				                "width": "100%"
				            })
				        }, "json");
		            })
		        }, "json");
                jQuery("#query").click(query);
                jQuery("#resetForm").click(resetForm);
                var mydata=[
							{CNAME:'公司',COUNTNUM:'',A:'',B:'',C:'',D:'',E:'',F:'',G:'',H:'',I:''},
							{CNAME:'小区',COUNTNUM:'',A:'',B:'',C:'',D:'',E:'',F:'',G:'',H:'',I:''},
							{CNAME:'住户',COUNTNUM:'',A:'',B:'',C:'',D:'',E:'',F:'',G:'',H:'',I:''},
							{CNAME:'开门广告点击',COUNTNUM:'',A:'',B:'',C:'',D:'',E:'',F:'',G:'',H:'',I:''},
							{CNAME:'首屏广告点击',COUNTNUM:'',A:'',B:'',C:'',D:'',E:'',F:'',G:'',H:'',I:''},
							{CNAME:'订单数',COUNTNUM:'',A:'',B:'',C:'',D:'',E:'',F:'',G:'',H:'',I:''},
							{CNAME:'订单金额',COUNTNUM:'',A:'',B:'',C:'',D:'',E:'',F:'',G:'',H:'',I:''},
							{CNAME:'发帖',COUNTNUM:'',A:'',B:'',C:'',D:'',E:'',F:'',G:'',H:'',I:''},
							{CNAME:'评论',COUNTNUM:'',A:'',B:'',C:'',D:'',E:'',F:'',G:'',H:'',I:''},
							{CNAME:'点赞',COUNTNUM:'',A:'',B:'',C:'',D:'',E:'',F:'',G:'',H:'',I:''},
							{CNAME:'乐享动态',COUNTNUM:'',A:'',B:'',C:'',D:'',E:'',F:'',G:'',H:'',I:''},
							{CNAME:'门禁安装',COUNTNUM:'',A:'',B:'',C:'',D:'',E:'',F:'',G:'',H:'',I:''},
							{CNAME:'钥匙数',COUNTNUM:'',A:'',B:'',C:'',D:'',E:'',F:'',G:'',H:'',I:''},
							{CNAME:'开门记录',COUNTNUM:'',A:'',B:'',C:'',D:'',E:'',F:'',G:'',H:'',I:''},
							{CNAME:'信誉分',COUNTNUM:'',A:'',B:'',C:'',D:'',E:'',F:'',G:'',H:'',I:''}
						];
						for(var i=0; i<mydata.length; i++)  //循环给每行添加数据
						{
							$("#jqGrid").jqGrid('addRowData',i+1,mydata[i]);
						}
            });
    function resetForm() {
        location.reload();
        return false;
    }
	function query() {
		var $agtCode = $("#agtCode").val();
	    var $tCommunityId = $("#communityId").val();
       
        $("#jqGrid").jqGrid('setGridParam', {
            url: "${pageContext.request.contextPath}/admin/tagent_pmsReports.action",
            postData: {
                'agtCode': $agtCode,
                'tCommunityId': $tCommunityId
            }, //发送数据
            page: 1
        }).trigger("reloadGrid"); //重新载入*/
        return false;
    }
	window.onload=function(){
		function BrowserType(){
			//获取浏览器的userAgent代理号；
			var userAgent=navigator.userAgent;
			
			//判断是否是Opera浏览器
			var isOpera=userAgent.indexOf("Opera")>-1;
			//判断是否是IE浏览器
			var isIE=userAgent.indexOf("compatible")>-1 && userAgent.indexOf("MSIE")>-1 && !isOpera;
			//判断是否是IE7浏览器
			if(isIE){
				var relIE=new RegExp("MSIE(\\d+\\.\\d+);");
				
				relIE.test(userAgent);
				var arr=userAgent.split(";")
				var flEVersion=arr[1].indexOf("7");
				console.log(flEVersion);
				if(flEVersion>-1){
					$tr=$("thead tr th");
					$td=$("tbody tr td");
					var len=$tr.length;
					for(var i=0;i<len;i++){
						$tr[i].style.width=10+"px";
						$td[i].style.width=10+"px";
					};
					console.log("IE7");
				}
			}
		};
		BrowserType();
	};
</script>
</body>
</html>
